<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ taglib uri="http://www.myce.net.cn/ce-tag" prefix="ce"%>
<%@ taglib uri="/WEB-INF/tld/pms-tag.tld" prefix="mypms" %>
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>增加家庭成员&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<script type="text/javascript" src="${ctx}/scripts/common/prototype.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jscalendar-1.0/calendar.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jscalendar-1.0/lang/calendar-en.js"></script>
<script type="text/javascript" src="${ctx}/scripts/jscalendar-1.0/calendar-setup.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/validation/validation.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/validation/effects.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/pages/com/ce/pms/customer/member/member.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/show.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/global.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/public3.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/div/common.js"></script>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script language="JavaScript"  src="${ctx}/scripts/ajaxException.js"></script>
<link href="${ctx}/styles/grid.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/listTable.css" rel="stylesheet" type="text/css">
<link href="${ctx}/styles/show.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/styles/public.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" media="all" href="${ctx}/scripts/jscalendar-1.0/calendar-blue2.css" title="win2k-cold-1" />
<link href="${ctx}/styles/aux_window.css" rel="stylesheet" type="text/css">

<script>
//定义一个全局的URL
var ACTION_URL="${ctx}/customer_memberAction.do?";
var interestObj = null;
var windowObj = null;
var individual = null;

var submitType= "individual";

	var submitFormName = "fCallInPerson"; //将提交的表单名称
	var closeFlag = false;  //标识点击并新增、保存按钮
	function submitForm(){
		var isPass=$(submitFormName).fireEvent("onSubmit");
		if(isPass){
			windowObj.setButtonUserable(false); //设置按钮不可用
			var url = $(submitFormName).action;
			var parameters = $(submitFormName).serialize();
			sendAjaxRequest(url,parameters,closeFrm);
		}
	}



//初始化
function init(){
	windowObj = new WindowObj('btn1_42','btn1_52','btn1_32');
	individual = new Individual(windowObj,'fCallInPerson');
	individual.init();
	interestObj = new Interest('selectedInterest','unSelectInterest');
}

//增加操作
function addCallInPerson(){
	saveCallInPerson("showResponseAdd");
}

//增加并新增操作
function addAgainCallInPerson(){
	saveCallInPerson("showResponseAddAgain");
}

//保存操作,参数为响应结果的方法
function saveCallInPerson(fname){
	var url= ACTION_URL + "method=addMember";
	var pars=$('fCallInPerson').serialize();
	//校验
	var isTure=$("fCallInPerson").fireEvent("onSubmit")
	//ajax提交
	if(isTure){
		closeORopenButton();
		var myAjax = new Ajax.Request(
	                    url,
	                    {method: 'post', parameters: pars, onComplete: eval( fname )}
	                    );
	}
}
//保存操作的响应
function showResponseAdd(result){
ajaxSubmitException(result.responseText);
  if(result.responseText == 'true'){
	var obj=findFrame("memberBaseList");
	obj.parent.reLoadIFrameList();
	closeORopenButton();
	windowClose();
	}else{
	alert(result.responseText);
	}
}

//保存并新增操作的响应
function showResponseAddAgain(result){
	ajaxSubmitException(result.responseText);
	var obj=findFrame('memberBaseList');
	obj.parent.reLoadIFrameList();
	closeORopenButton();
	location.reload();
}
//关闭或打开按钮事件
function closeORopenButton(){
	$('window_footer').disabled= !$('window_footer').disabled;
	$('btn1_42').disabled= !$('btn1_42').disabled;
	$('btn1_52').disabled= !$('btn1_52').disabled;
	$('btn1_32').disabled= !$('btn1_32').disabled;
}

</script>
</head>

<body onload="init()">
<form action="" id="fCallInPerson" method="post" class="required-validate">
<input type="hidden" id="participantId" name="participantId" value=""/>
<input type="hidden" id="oldHouseId" name="oldHouseId" value="${memberVO.houseId}"/>
<div style="overflow:auto; height:500px;">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">增加家庭成员</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td valign="middle" class="content">
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="container_in_show">
        <tr>
          <td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" id="tab_subMenu1">
              <tr>
                <td><table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
                    <tr>
                      <td><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
                          <tr>
                            <td colspan="4" class="aux_titletable">基本资料</td>

                             </tr>
                          <tr>
                            <td class="aux_intable_td1">房号：</td>
                           <td class="aux_intable_require">
                               <ce:unitedSelect
                          	dataList="${houseNumList}"
                          	id="houseNumber"
                          	name="houseId"
                          	optionLabel="houseNumber"
                          	className="select-one-required"
                          	optionValue="houseId"
                          	selectText="请选择..."
                          	onChange="individual.setInfoByCertificate();"
                          	>
                          	</ce:unitedSelect>
                            </td>
                            <td class="aux_intable_td1">证件类型：</td>
                          <td class="aux_intable_require">
                          	<pms:unitedSelect id="certificateType"  selectText="请选择..."
											name="ID_typeId" dataList="${certificateTypes}"
											optionLabel="idTypeName"
											className="select-one-required"
											optionValue="idTypeId"
											onChange="individual.setInfoByCertificate();"
											>
										</pms:unitedSelect>

                         </td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">所属业主/租户姓名：</td>
                            <td class="aux_intable_require"><ce:unitedSelect
                          	dataList="${customerNameList}"
                          	id="ownerName"
                          	name="ownerId"
                          	optionLabel="participantName"
                          	className="select-one-required"
                          	optionValue="participantId"
                          	selectText="请选择..."
                          	>
                          	</ce:unitedSelect>
                            </td>
                            <td class="aux_intable_td1">证件号码：</td>
                            <td class="aux_intable_require"><input name="certificateNo" type="text" class="inputtext required validate-char" size="16" onblur="individual.setInfoByCertificate();" maxlength="36">    </td>
                            </td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">姓名：</td>
                            <td class="aux_intable_require"><input name="participantName" type="text"  class="required validate-char" value="" size="16" maxlength="80">                            </td>
                            <td class="aux_intable_td1">与业主/租户关系：</td>
                            <td class="aux_intable_require">
                               <ce:unitedSelect
                          	dataList="${reletionTypeList}"
                          	id="relation"
                          	name="relationTypeId"
                          	optionLabel="relationTypeName"
                          	className="select-one-required"
                          	optionValue="relationTypeId"
                          	selectText="请选择..."
                          	>
                          	</ce:unitedSelect>
                            </td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">性别：</td>
                                      <td class="aux_intable_require"><mypms:Radio id="indSex" name="sexId" code="CS_INDIVIDUAL_SEX" className="validate-one-required"></mypms:Radio></td>
                            <td class="aux_intable_td1">联系电话：</td>
                            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                  <td><input name="telephone" type="text" class="inputtext validate-char" value=""  size="16" maxlength="80"></td>
                                  <td width="4">&nbsp;</td>
                                  <td><img src="${ctx}/images/ico-aux_household_sj.gif" width="16" height="16"></td>
                                </tr>
                            </table></td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">称呼：</td>
                            <td class="aux_intable_td2"><input name="appellative" type="text" class="inputtext validate-char" value="" maxlength="20" size="16">                            </td>
                            <td class="aux_intable_td1">&nbsp;</td>
                            <td class="aux_intable_td2">&nbsp;</td>
                          </tr>







                         <tr>
                            <td colspan="4" class="aux_titletable">其他资料</td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">出生年月：</td>
                            <td class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td><input name="birthday" type="text" class="validate-date-yyyy-mm-dd validate-ajax"
                                             replaceId="dataValue"
                              validateUrl="${ctx}/common_sysrefcodeAction.do?method=compareCurrentDate&dateFormat=yyyy-MM-dd&compareType=smallCurrentDate" validateMessage="输入的出生日期必须小于当前系统时间"  value="" size="16" afterInsert="birthDateAfter" maxlength="10"></td>
                                            <td width="4">&nbsp;</td>
                                            <td><img id="imgBirthDate" src="${ctx}/images/ico_clock.gif" width="20" height="20"><span id="birthDateAfter"></span></td>
                                          </tr>
                                      </table></td>
                            <td rowspan="2" valign="top" class="aux_intable_td1">兴趣爱好：</td>
                             <td rowspan="2" class="aux_intable_td2"><table border="0" cellspacing="0" cellpadding="0">
                                          <tr>
                                            <td>
                                              	<pms:unitedSelect id="unSelectInterest"
                                              					   size="5"
                                              					   multiple="multiple"
                                              					   value="${memberVO.interest}"
                                              					   style="width:100px;height:60px;color:#000000;border: 1px solid #9299A3;padding-top: 3px;"
                                              					   ondblclick="interestObj.moveToRight()"
																   name="unSelectInterest"
																   dataList="${interestes}"
													               optionLabel="name"
													               optionValue="interestId" >
												</pms:unitedSelect>
                                              </td>
                                            <td><table border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                  <td width="4" style="width:4px;"></td>
                                                  <td width="4" class="between_space_both"></td>
                                                  <td>
                                                  <pms:unitedSelect id="selectedInterest"
                                                  				    size="5"
                                                  				    multiple="multiple"
                                                  				    style="width:100px;height:60px"
                                                  				    ondblclick="interestObj.moveToLeft();"
																	name="selectedInterest"
																	dataList="${IndividualInterestes}"
													 		        optionLabel="name"
													                optionValue="interestId" >
												  </pms:unitedSelect>
												  <input type="hidden" name="interest" value="${memberVO.interest}"/>
                                                  </td>
                                                </tr>
                                            </table></td>
                                          </tr>
                                      </table></td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">籍贯：</td>
                            <td class="aux_intable_td2"><input name="homePlace" type="text" class="inputtext validate-char" value="" maxlength="200" size="16"></td>
                          </tr>
                          <tr>
                            <td class="aux_intable_td1">户口所在地：</td>
                            <td class="aux_intable_td2"><input name="registerPlace" type="text" class="inputtext validate-char" value="" maxlength="200" size="16"></td>
                            <td rowspan="2" valign="top" class="aux_intable_td1">备注：</td>
                            <td rowspan="2" valign="top" class="aux_intable_td2"><textarea name="remark" value="${memberVO.remark}"  cols="29" rows="2" class="max-length-1000"></textarea></td>
                          </tr>
                          <tr>
                            <td valign="top" class="aux_intable_td1">职业：</td>
                            <td valign="top" class="aux_intable_td2"><input name="profession" type="text" class="inputtext validate-char" value="" maxlength="30" size="16"></td>
                          </tr>




                      </table></td>
                    </tr>
                </table></td>
              </tr>
          </table></td>
        </tr>
      </table>

   </td>
  </tr>
  <tr>
    <td class="window_footer" id="window_footer"><table border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_41"></td>
              <td class="buttonOffMiddle" id="btn1_42" onClick="if(individual.setInfoByCertificate()){addAgainCallInPerson();}" onMouseOver="btn_change_over(4)" onMouseOut="btn_change_out(4)" onblur="btn_change(4)"><img src="${ctx}/images/ico_htn_interim.gif" alt="" width="14" height="15" border="0" align="absbottom">&nbsp;保存并新增</td>
              <td class="buttonOffRight" id="btn1_43"></td>
            </tr>
          </table></td>
		  <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0" >
            <tr>
              <td class="buttonOffLeft" id="btn1_51"></td>
              <td class="buttonOffMiddle" id="btn1_52" onblur="btn_change(5)" onMouseOver="btn_change_over(5)" onMouseOut="btn_change_out(5)" onClick="if(individual.setInfoByCertificate()){addCallInPerson();}"><img src="${ctx}/images/ico_ok.gif" border="0" align="absmiddle" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_53"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onblur="btn_change(3)" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onclick="windowClose();"><img src="${ctx}/images/ico_cancel.gif" border="0" align="absmiddle" /> 关 闭</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table>
	</td>
</tr>
</table>
</div>
</form>
<script type="text/javascript">
              Calendar.setup(
              {
	              inputField : "birthday", // ID of the input field
	              ifFormat : "%Y-%m-%d", // the date format
	              button : "imgBirthDate", // ID of the button
	              align          :    "Tl",           // alignment (defaults to "Bl")
			      singleClick    :    true
              }
              );


</script>
</body>
</html>